﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using RapidWebDev.Common;
using RapidWebDev.Platform.Initialization;
using AspNetMembership = System.Web.Security.Membership;

namespace RapidWebDev.SearchIndex.Tests
{
    /// <summary>
    /// Global Setup
    /// </summary>
    [SetUpFixture]
    public class SetupFixture
    {
        /// <summary>
        /// 
        /// </summary>
        [SetUp]
        public virtual void GlobalSetup()
        {
            Console.Out.WriteLine("************Global Setup Started! ************\r\n");
            IApplicationNameRouter MockApp = SpringContext.Current.GetObject<IApplicationNameRouter>("FirstApplicationNameRouter");

            IInstallerManager InstallManager = new InstallerManager();
            InstallManager.Installers = new List<IInstaller>() { SpringContext.Current.GetObject<IInstaller>("MockInstaller") };
            InstallManager.Install(MockApp.GetApplicationName());

            IApplicationNameRouter MockApp1 = SpringContext.Current.GetObject<IApplicationNameRouter>("SecondApplicationNameRouter");
            InstallManager.Installers = null;
            InstallManager.Installers = new List<IInstaller>() { SpringContext.Current.GetObject<IInstaller>("MockInstaller2") };
            InstallManager.Install(MockApp1.GetApplicationName());           

            Console.Out.WriteLine("\r\n************Global Setup Done! ************\r\n");
        }
    }
}
